# 爬取股票交易数据并进行简单统计
import requests

headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'}

def get_all_data(data_list, addr):
    page = 1
    flag = True
    while flag:
        url = "https://stock.gtimg.cn/data/index.php?appn=detail&action=data&c=" + addr + "&p=" + str(page)
        response = requests.get(url, headers=headers)
        response.encoding = "utf-8"
        html = response.text
        str_list = html.split('"')
        if len(str_list) <= 1:
            flag = False
        else:
            print(str_list)
            data_list.extend(str_list[1].split("|"))
            page = page + 1


